# coding=utf-8
"""
    @project: python-learning-notes
    @Author：frank
    @file： urllib_request.py
    @date：2023/10/16 20:07
"""
import urllib.request

if __name__ == "__main__":
    response = urllib.request.urlopen('https://www.sina.com.cn/', timeout=5000)
    response_str = response.read().decode('utf-8')
    print(response_str)
    print(response.geturl())
    print(response.getcode())

    # 补充 string.encode() => bytes
    # bytes.decode() => string


